<?php
require_once '../pdf/fpdf.php';
require_once '../inc/configuration.php';
require_once '../inc/connexion_db.php';
require_once '../inc/fonctions_identification.php';

// avec utilisation des cookies
proteger_page("login", CHEMIN);

$sql = "SELECT C.id, C.id_entreprise, C.nom, C.prenom, C.telephone, C.email, C.observations, "
        . "E.id, E.raison_sociale, E.adresse FROM contacts C, entreprises E "
        . "WHERE C.id_entreprise = E.id ";
$req = mysqli_query($connexion_bd, $sql);

$pdf = new FPDF();


while($data = mysqli_fetch_assoc($req)) {
    $pdf->AddPage("P", array(85,54));
    
    $pdf->SetTextColor(123,146,140);
    //$pdf->SetMargins(4, 4, 4);
    //$pdf->SetXY(4,4);
    //$pdf->Cell(30,26, "", 1, 0);
    $pdf->Image('../contacts/photos/bouteille_bateau.jpg',3,3,30,20);
    //$pdf->cell(26;
    $pdf->SetXY(35,3);
    $pdf->SetAutoPageBreak(false , 0);
    $pdf->SetFont('Arial','',14);
    $pdf->Cell(47,8, $data["raison_sociale"], 0, 2);
    $pdf->Cell(47,3, '', 0, 2);
    $pdf->SetFont('Arial','',10);
    $pdf->MultiCell(47,4, $data["adresse"], 0,'L');
    //$pdf->Cell(47,10, $data["adresse"], 1,0);
    $pdf->SetFillColor(148,154,152);    
    $pdf->SetXY(0, 25);
    $pdf->Cell(85, 2, '', 0, 0,'',true);
 
    $pdf->SetFillColor(199,207,204);
    $pdf->SetTextColor(7,7,7);
    $pdf->SetXY(0, 27);
    $pdf->Cell(85, 30, '', 0, 0,'',true);
    $pdf->SetXY(3,28);
    $pdf->MultiCell(35,4, $data["observations"], 0,'L');
    $pdf->SetXY(35, 28);
    $pdf->Cell(40,4,$data["telephone"], 0, 2, 'R',true);
    $pdf->SetXY(3,36);
    $pdf->SetFont('Arial','',14);
    $pdf->Cell(35,7, $data["nom"]."".$data["prenom"], 0,2); 
    $pdf->SetFont('Arial','',10);
    $pdf->Cell(35,4,$data["email"],0,2);
    $pdf->Cell(35,4,"Site web / Autre", 0,2);
    
}
$pdf->Output();
 
  ?>
 
 <html>
    <head>
        <meta charset="ISO-8859-1">
        <title></title>
    </head>
    <body>
        <?php
        // put your code here
        ?>
    </body>
</html>
